// 云函数入口文件
const cloud = require('wx-server-sdk')
const QQMapWX = require('./api/qqmap-wx-jssdk')
cloud.init()
const db = cloud.database()
// 云函数入口函数
exports.main = async (event, context) => {
    const wxContext = cloud.getWXContext()

    return new Promise((resolve,reject) =>{
		let qqmapsdk = new QQMapWX({
			key: 'EYJBZ-3TO6K-CFNJS-AQRF3-JHMBQ-E5BRJ'
		})
		
		qqmapsdk.reverseGeocoder({ //调用腾讯地图api逆地址解析
			location: {
				latitude: 24.9034,
				longitude: 118.541,
			},
			get_poi: 1, //是否返回周边列表
			success(res) {
				console.log(res.result.pois)
				resolve(res.result.pois)
			}
		})
	})
}